package cn.wj.school.app.dto;

import cn.wj.school.common.dto.BaseMsg;
import cn.wj.school.common.enums.MsgType;
import io.netty.buffer.ByteBuf;
import lombok.Data;

/**
 * @Author: yueding
 * @Description: 登录相应
 * @Date: Created in 17:44 2018/12/27
 * @Modified By: yueding Copyright(c) cai-inc.com
 */
@Data
public class LoginReqMsg extends BaseMsg {

    private String userName;

    private String password;

    /**
     * 获取消息类型
     *
     * @return
     */
    @Override
    public MsgType getMsgType() {
        return MsgType.LOGIN;
    }

    @Override
    public void writeBody(ByteBuf buf) {
        writeUTF8(buf, userName);
        writeUTF8(buf, password);
    }

    @Override
    public void readBody(ByteBuf buf) {
        this.userName = readUTF8(buf);
        this.password = readUTF8(buf);
    }
}
